<template>
	<div class='pop-share-weixin'>
		<div class='pop-head'>
			<div class='title'>分享到</div>
			<a class='icon-close-pop yz-pop-close'></a>
		</div>
		<center>
			<div class='icon-weixin' @click="shareToWeixinFriend">
				<img src='../../../static/img/wx.png' /><br/>
				<span>微信</span>
			</div>
			<div @click="shareToWeixinTimeline" class='icon-weixin'>
				<img src='../../../static/img/wxtime.png' /><br/>
				<span>朋友圈</span>
			</div>
		</center>
	</div>
</template>

<script>
	import { Toast } from 'mint-ui';

	export default {
		props: ['options'],
		data() {
			return {}
		},
		methods: {
			_closeShareModel(){
				this.$emit("closeShareModel",false)
			},
			shareToWeixinFriend() {
				this._closeShareModel();
				let shares;
				let sharewx;
				let _this = this;
				plus.share.getServices(function(s) {
					shares = s;
					for(var i in s) {
						if('weixin' == s[i].id) {
							sharewx = s[i];
							_this.options.extra = {
								scene: 'WXSceneSession'
							};
							sharewx.send(_this.options, function() {}, function(e) {});
						}
					}
				}, function(e) {});
			},
			shareToWeixinTimeline() {
				this._closeShareModel();
				let shares;
				let sharewx;
				let _this = this;
				plus.share.getServices(function(s) {
					shares = s;
					for(var i in s) {
						if('weixin' == s[i].id) {
							sharewx = s[i];
							_this.options.extra = {
								scene: 'WXSceneTimeline'
							};
							sharewx.send(_this.options, function() {}, function(e) {});
						}
					}
				}, function(e) {});
			}
		},
		mounted() {
			console.log(this.options)
		}
	}
</script>

<style lang="scss" scoped>
	%flex-dirx {
		display: -webkit-box;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-orient: horizontal;
		-webkit-box-direction: normal;
		-ms-flex-direction: row;
		flex-direction: row;
		-webkit-box-align: center;
		-ms-flex-align: center;
		align-items: center;
	}
	
	%pop-head {
		@extend %flex-dirx;
		.title {
			-webkit-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			font-size: 40px;
			line-height: 56px;
			color: #4a4a4a;
		}
	}
	
	.pop-share-weixin {
		width: 700px;
		padding: 40px 50px;
		.pop-head {
			@extend %pop-head;
		}
		center {
			display: flex;
			justify-content: space-around;
		}
		.icon-weixin {
			display: inline-block;
			margin: 60px;
			font-size: 30px;
			color: #4a4a4a;
			img {
				width: 120px;
				margin-bottom: 30px;
			}
		}
	}
</style>